package com.gitee.huanminabc.utils_tools.security.dal.dao.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gitee.huanminabc.utils_tools.security.dal.dao.UsersRoleDaoService;
import com.gitee.huanminabc.utils_tools.security.dal.mapper.UsersRoleMapper;
import com.gitee.huanminabc.utils_tools.security.entity.UsersRoleEntity;
import com.gitee.huanminabc.dynamicdb.aop.DBSwitch;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@DBSwitch("resource")
public class  UsersRoleDaoServiceImpl extends ServiceImpl<UsersRoleMapper, UsersRoleEntity> implements UsersRoleDaoService {
    @Override
    public boolean save(UsersRoleEntity entity) {
        return super.save(entity);
    }

    @Override
    public List<UsersRoleEntity> getRole(String account) {
        LambdaQueryWrapper<UsersRoleEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(UsersRoleEntity::getAccount, account);
        return super.list(queryWrapper);
    }
}
